﻿@model PagedList.IPagedList<ISC_Web.ViewModels.VM_InventoryDt>
@using PagedList.Mvc;
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <script src="~/Scripts/jquery-1.12.3.js"></script>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    @*<link href="~/Content/AutoTable.css" rel="stylesheet" />*@

    <link href="~/Content/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <script src="~/Scripts/moment-with-locales.min.js"></script>
    <script src="~/Scripts/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Scripts/bootstrap.js"></script>
    <title></title>
</head>
<body style="overflow:auto">
    <div class="container-fluid">
        <div id="query_hint" class="query_hint">
            <img src="~/img/wait.gif" />正在查询，请稍等...
        </div>
        <div class="panel panel-default" style="margin-top:8px">
            <div class="panel-heading">
                @using (Html.BeginForm("Inventory", "StockManage", FormMethod.Get))
            {
                    @Html.AntiForgeryToken()
                        <div class="form-inline">
                            <div class="form-group">
                                <label id="lblisTerminalD">终端号:</label>
                                <input id="txtisterminalid_input" name="txtisterminalid_input" class="form-control input-sm" type="text" placeholder="1,2,3" style="width:60px" value="@ViewBag.TerminalID" />
                            </div> &nbsp; &nbsp;
                            <div class="form-group">
                                <label id="lblisGoodsCode">商品名:</label>
                                <input type="text" id="txtisGoodsCode" name="txtisGoodsCode" class="form-control input-sm" placeholder="编码、拼音码、名称" style="width:130px" value="@ViewBag.GoodsID" />
                            </div>&nbsp; &nbsp;
                            <div class="form-group">
                                <label>选择开始时间：</label>
                                <!--指定 date标记-->
                                <div class='input-group date' id='txtisdatetimepicker1'>
                                    <input type='text' class="form-control input-sm" placeholder="年-月-日" name="txtisdatetimepicker1" style="width:110px" value="@ViewBag.StartTime" />
                                    <span class="input-group-addon">
                                        <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                            </div> &nbsp; &nbsp;
                            <div class="form-group">
                                <label>选择结束时间：</label>
                                <!--指定 date标记-->
                                <div class='input-group date' id='txtisdatetimepicker2'>
                                    <input type='text' class="form-control input-sm" placeholder="年-月-日" name="txtisdatetimepicker2" style="width:110px" value="@ViewBag.EndTime" />
                                    <span class="input-group-addon">
                                        <span class="glyphicon glyphicon-screenshot"></span>
                                    </span>
                                </div>
                            </div>
                            &nbsp; &nbsp; &nbsp; &nbsp;
                            <div class="form-group">
                                <input type="submit" id="btnissearch" value="查  询" onclick="show_query_hint()" />

                                <a id="btnissearch1" tabindex="0" class="btn btn-primary hidden" role="button" data-toggle="popover" onclick="callbtnissearch()"
                                   data-trigger="focus" title="小秘书" data-content="查询的时候如果加上终端号,查询的速度会变快哦">查  询</a>
                            </div>
                        </div>
                }
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-condensed table-bordered table-hover" align="center" style="white-space:nowrap;">
                        <thead style="background: #EEEEEE;">
                            <tr>
                                <th class="text-center">终端编号</th>
                                <th class="text-center">订单号</th>
                                <th class="text-center">商品编码</th>
                                <th class="text-center">商品名称</th>
                                <th class="text-center">批号</th>
                                <th class="text-center">效期</th>
                                <th class="text-center">生产日期</th>
                                <th class="text-center">库存数</th>
                                <th class="text-center">实盘数</th>
                                <th class="text-center">RFID</th>
                                <th class="text-center">货位号</th>
                                <th class="text-center">更新人</th>
                                <th class="text-center">更新时间</th>
                            </tr>
                        </thead>
                        <tbody id="tbodytable">
                            @if (Model.Count == 0)
                            {
                                <tr>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                    <td>无数据</td>
                                </tr>
                            }
                            @foreach (var item in Model)
                            {
                                <tr>
                                    <td>@Html.DisplayFor(model => item.terminalID)</td>
                                    <td>@Html.DisplayFor(model => item.orderID)</td>
                                    <td>@Html.DisplayFor(model => item.goodsID)</td>
                                    <td>@Html.DisplayFor(model => item.goodsName)</td>
                                    <td>@Html.DisplayFor(model => item.batchNo)</td>
                                    <td>@Html.DisplayFor(model => item.expiryDate)</td>
                                    <td>@Html.DisplayFor(model => item.productDate)</td>
                                    <td>@Html.DisplayFor(model => item.orderNum)</td>
                                    <td>@Html.DisplayFor(model => item.actualNum)</td>
                                    <td>@Html.DisplayFor(model => item.RFIDCode)</td>
                                    <td>@Html.DisplayFor(model => item.locatorID)</td>
                                    <td>@Html.DisplayFor(model => item.updateMan)</td>
                                    <td>@Html.DisplayFor(model => item.updateTime)</td>
                                </tr>

                            }
                        </tbody>
                    </table>
                </div>
            </div>
            <div style="position:fixed;height:60px;bottom:0px;">
                <form class="form-inline">

                    <div class="form-group">
                        @Html.PagedListPager(Model, page => Url.Action("Inventory", new
                   {

                       page,
                       txtisterminalid_input = ViewBag.TerminalID,
                       txtisGoodsCode = ViewBag.GoodsID,
                       txtisdatetimepicker1 = ViewBag.StartTime,
                       txtisdatetimepicker2 = ViewBag.EndTime
                   })
, new PagedListRenderOptions { LinkToFirstPageFormat = "首页", LinkToPreviousPageFormat = "上一页", LinkToNextPageFormat = "下一页", LinkToLastPageFormat = "尾页", MaximumPageNumbersToDisplay = 20 })

                    </div>&nbsp;&nbsp;
                    <div class="form-group">
                        总记录数:@Model.TotalItemCount 行
                    </div>


                </form>
            </div>
            </div>
        </div>

        <script type="text/javascript">
            $(function () {
                var picker1 = $('#txtisdatetimepicker1').datetimepicker({
                    format: 'YYYY-MM-DD',
                    locale: moment.locale('zh-cn'),
                    //minDate: '2016-7-1'
                });


                var picker2 = $('#txtisdatetimepicker2').datetimepicker({
                    format: 'YYYY-MM-DD',
                    locale: moment.locale('zh-cn')
                });
                //动态设置最小值
                picker1.on('dp.change', function (e) {
                    picker2.data('DateTimePicker').minDate(e.date);
                });
                //动态设置最大值
                picker2.on('dp.change', function (e) {
                    picker1.data('DateTimePicker').maxDate(e.date);
                });
            });
            function callbtnissearch() {

                document.getElementById("btnissearch").click();
            }
        </script>
</body>
</html>
<script type="text/javascript">

    //页面加载完成之后去掉Loading
    $(document).ready(function () {
        // parent.frames[0].queryHintCallback();
        queryHintCallback();
    });

function show_query_hint(){
    var query_hint = document.getElementById("query_hint");
    query_hint.style.display="block";
}



function queryHintCallback(){
    var query_hint = document.getElementById("query_hint");
    query_hint.style.display="none";
}
</script>
